import React from 'react';
import { PageContainer } from '@ant-design/pro-layout';
import { history, Link, useIntl } from 'umi';
import { Button } from 'antd';

import type { ConnectProps } from 'umi';

interface Props extends ConnectProps {

}

const DataSourceList: React.FC<Props> = (props) => {
  const { formatMessage: f } = useIntl();
  const { match } = props;
  const { id: dataPoolId } = match?.params as { id: string };

  console.log('dataPoolId', dataPoolId);

  return (
    <PageContainer onBack={() => history.push('/dataPoolManage/list')}>
      <Link to={`/dataPoolManage/source/${dataPoolId}/add`}>
        <Button type='primary'>{f({ id: 'menu.dataPoolManage.source.add' })}</Button>
      </Link>
      <Link to={`/dataPoolManage/source/${dataPoolId}/edit/1`}>
        <Button type='primary' style={{ marginLeft: 16 }}>编辑数据源</Button>
      </Link>
      <Link to={`/dataPoolManage/source/${dataPoolId}/detail/1`}>
        <Button type='primary' style={{ marginLeft: 16 }}>数据源详情</Button>
      </Link>
      <Link to={`/dataPoolManage/source/${dataPoolId}/view-data/1`}>
        <Button type='primary' style={{ marginLeft: 16 }}>查看数据</Button>
      </Link>
    </PageContainer>
  )
}

export default DataSourceList;